package com.zscat.mallplus.controller;


import com.zscat.mallplus.annotation.IgnoreAuth;
import com.zscat.mallplus.qsg.CostDuration;
import com.zscat.mallplus.qsg.IQsgCostDurationService;
import com.zscat.mallplus.utils.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 消费时长管理Controller
 */
@RestController
@Api(tags = "QsgCostDurationController", description = "消费时长管理")
@RequestMapping("/api/costduration")
public class QsgCostDurationController {

    @Autowired
    private IQsgCostDurationService costDurationService;

    @IgnoreAuth
    @GetMapping(value = "/getTop10Users")
    @ApiOperation(value = "根据店铺id查询top10的消费时长用户列表")
    public Object getTop10Users(Integer storeId) {
        List<CostDuration> costDurations = costDurationService.getTop10UsersForMonth(storeId);
        return new CommonResult().success(costDurations);
    }

}
